IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_MachineCluster_Machine_MemberMachine]') AND parent_object_id = OBJECT_ID(N'[dbo].[MachineCluster]'))
BEGIN
     ALTER TABLE [dbo].[MachineCluster] DROP CONSTRAINT [FK_MachineCluster_Machine_MemberMachine]
END
GO

ALTER TABLE [dbo].[MachineCluster] WITH CHECK ADD CONSTRAINT [FK_MachineCluster_Machine_MemberMachine] 
     FOREIGN KEY([MemberMachineId]) REFERENCES [dbo].[Machine] ([MachineId])
GO
